package com.settlement.system.service.impl;

import com.settlement.system.mapper.BaseMapper;
import com.settlement.system.mapper.TblReceiveRefundShopMapper;
import com.settlement.system.common.exception.ServiceException;
import com.settlement.system.model.entity.common.SinglePage;
import com.settlement.system.model.entity.common.TblReceiveRefundShop;
import com.settlement.system.model.entity.common.TblRrAccountSubject;
import com.settlement.system.model.entity.common.TblRrChannel;
import com.settlement.system.service.ITblReceiveRefundShopService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 收退款-店铺 服务实现类
 *
 * @author Ximi
 * @since 2020-07-07
 */
@Service
@Slf4j
public class TblReceiveRefundShopServiceImpl extends BaseServiceImpl implements ITblReceiveRefundShopService {

    @Resource
    private TblReceiveRefundShopMapper tblReceiveRefundShopMapper;

    @Override
    public BaseMapper init() {
        return tblReceiveRefundShopMapper;
    }

    @Override
    public TblReceiveRefundShop getByShopNo(String shopNo) throws ServiceException {
        try {
            return tblReceiveRefundShopMapper.getByShopNo(shopNo);
        } catch (Exception ex){
            log.error("Get ReceiveRefundShop by shopNo happen exception",ex);
            throw new ServiceException("Get ReceiveRefundShop by shopNo happen exception",ex);
        }
    }

    @Override
    public TblReceiveRefundShop getByNcShopNo(String ncShopNo) throws ServiceException {
        try {
            return tblReceiveRefundShopMapper.getByNcShopNo(ncShopNo);
        } catch (Exception ex){
            log.error("Get ReceiveRefundShop by ncShopNo happen exception",ex);
            throw new ServiceException("Get ReceiveRefundShop by ncShopNo happen exception",ex);
        }
    }

    @Override
    public TblReceiveRefundShop getByNcShopName(String ncShopName) throws ServiceException {
        try {
            return tblReceiveRefundShopMapper.getByNcShopName(ncShopName);
        } catch (Exception ex){
            log.error("Get ReceiveRefundShop by ncShopName happen exception",ex);
            throw new ServiceException("Get ReceiveRefundShop by ncShopName happen exception",ex);
        }
    }

    @Override
    public List<TblReceiveRefundShop> getByNcEnterAccountBody(String ncEnterAccountBody) throws ServiceException {
        try {
            return tblReceiveRefundShopMapper.getByNcEnterAccountBody(ncEnterAccountBody);
        } catch (Exception ex){
            log.error("Get ReceiveRefundShop by ncEnterAccountBody happen exception",ex);
            throw new ServiceException("Get ReceiveRefundShop by ncEnterAccountBody happen exception",ex);
        }
    }

    @Override
    public TblReceiveRefundShop getByThreeChannelNo(String threeChannelNo) throws ServiceException {
        try {
            return tblReceiveRefundShopMapper.getByThreeChannelNo(threeChannelNo);
        } catch (Exception ex){
            log.error("Get ReceiveRefundShop by threeChannelNo happen exception",ex);
            throw new ServiceException("Get ReceiveRefundShop by threeChannelNo happen exception",ex);
        }
    }

    @Override
    public List<TblReceiveRefundShop> getNcShop(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return tblReceiveRefundShopMapper.getNcShop(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取店铺异常", ex);
            throw new ServiceException("获取店铺异常", ex);
        }
    }

    @Override
    public Integer getNcShopCount(Map<String, Object> params) throws ServiceException {
        try {
            return tblReceiveRefundShopMapper.getNcShopCount(params);
        } catch (Exception ex) {
            log.error("获取NC店铺数量异常", ex);
            throw new ServiceException("获取NC店铺数量异常", ex);
        }
    }


    @Override
    public TblReceiveRefundShop selectExistShop(TblReceiveRefundShop subject) throws ServiceException {
        try {
            return tblReceiveRefundShopMapper.selectExistShop(subject);
        } catch (Exception ex){
            log.error("selectExistSubject exception",ex);
            throw new ServiceException("selectExistSubject exception",ex);
        }
    }
}

